
import { Column, Table, HasMany } from 'sequelize-typescript';
import { BaseModel } from '@/model'
import { DataTypes } from "sequelize";
import { Action } from './action.model'

@Table
export class Menu extends BaseModel {
  @Column({ type: DataTypes.STRING, primaryKey: true, allowNull: false, comment: '菜单moduleId' })
  moduleId: string;

  @Column({ type: DataTypes.STRING, allowNull: false, comment: "菜单名称" })
  moduleName: string;

  @Column({ type: DataTypes.STRING, defaultValue: "-1", allowNull: false, comment: "父级Id" })
  parentId: string;

  @Column({ type: DataTypes.INTEGER, defaultValue: 0, allowNull: false, comment: "排序" })
  typeOrder: number;

  @Column({ type: DataTypes.STRING, allowNull: false, comment: "组件路径" })
  path: string;

  @Column({ type: DataTypes.STRING, comment: "模型类别" })
  modelClassify: string;

  @Column({ type: DataTypes.STRING, comment: "模型Id" })
  templateID: string;

  @Column({ type: DataTypes.STRING, comment: "绑定工艺图Id" })
  flowId: string;

  @Column({ type: DataTypes.STRING, comment: "列表模型Id" })
  listModelId: string;

  @Column({ type: DataTypes.STRING, comment: "模型应用场景" })
  useSence: string;

  @Column({ type: DataTypes.STRING, comment: "项目编码" })
  projectCode: string;

  @Column({ type: DataTypes.STRING, comment: "菜单编码" })
  moduleCode: string;

  @Column({ type: DataTypes.STRING, comment: "菜单图标" })
  icon: string;

  @Column({ type: DataTypes.STRING, comment: "重定向" })
  redirect: string;

  @Column({ type: DataTypes.STRING, comment: "嵌入iframe地址" })
  frameSrc: string;

  @Column({ type: DataTypes.STRING, comment: "需要统计的接口" })
  statisticsUrl: string;

  @Column({ type: DataTypes.STRING, comment: "快捷导航图标" })
  quickNavigationIcon: string;

  @Column({ type: DataTypes.NUMBER, comment: "菜单类型" })
  menuType: number;

  @Column({ type: DataTypes.NUMBER, comment: "背景类型" })
  bgType: number;

  @Column({ type: DataTypes.STRING, comment: "背景色" })
  bgColor: string;

  @Column({ type: DataTypes.NUMBER, comment: "状态" })
  typeStatus: number;

  @Column({ type: DataTypes.NUMBER, comment: "显示状态" })
  visible: number;

  @Column({ type: DataTypes.NUMBER, comment: "是否外链" })
  isExt: number;

  @Column({ type: DataTypes.STRING, comment: "路由meta" })
  extMeta: string;

  @HasMany(() => Action)
  actions: Action[];
}
